package org.supda.system.service.impl;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.supda.system.dao.TLogDao;
import org.supda.system.entity.TLog;
import org.supda.system.service.TLogService;
import org.supda.system.util.DataTablePageUtil;

/**
 * 日志管理
 * @author supda
 * @Date 2017-3-13 下午4:49:06
 *
 */
@Service("TLogService")
@Transactional
public class TLogServiceImpl implements TLogService{

	@Autowired private TLogDao tLogDao;

	@Override
	public void create(TLog tlog) {
		tLogDao.save(tlog);
	}

	@Override
	public void listByDataTable(DataTablePageUtil<TLog> dtp) {
		tLogDao.listByDataTable(dtp, TLog.class);
	}

	@Override
	public void delLogs(Long[] id) {
		if(id!=null && id.length >0){
			
			for(Long ids : id){
				TLog tlog = findById(ids);
				tLogDao.delete(tlog);
			}
		}
	}

	public TLog findById(Long id) {
		return tLogDao.get(TLog.class, id);
	}
}
